import React, { useState } from 'react'
import PubSub from 'pubsub-js'
export default function Gege() {
    const [car,setCar] = useState('八手奥迪')
    const value = '一手雅迪'
    const changeCarHandle = () => {
        setCar(value)
        //PubSub中的方法publish设置公告资源，第一个参数是名字，第二个参数是值
        PubSub.publish('qiche',value)
    }

  return (
    <div>
        <div>我是哥哥 我开的{car}</div>
        <button onClick={changeCarHandle}>换车</button>
    </div>
  )
}
